<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
if($_RQ['op']=='get'){
	$this->model('model')->checkjuese(5);
	$juese_id=$_SESSION['juese_id']==5?$_SESSION['juese_id']:5;
	$workerids=$this->model('model')->getworkerids($juese_id);
	pdo_update('jy_yxw_member',array('oldworker5id'=>$_SESSION['workerid']),array('oldworker5id'=>0,'worker5id'=>$_SESSION['workerid'],'uniacid'=>$_SESSION['uniacid']));
	//显示统计数据
	$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
	$status4=array(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,32,33,34,35,36,37,38,39,40,41,42,100);
	$shangmen['all']=pdo_count('jy_yxw_member',array('worker'.$juese_id.'id'=>$workerids,'uniacid'=>$_SESSION['uniacid'],'zhun_time >'=>100),'id');
	$shangmen['day']=pdo_count('jy_yxw_member',array('worker'.$juese_id.'id'=>$workerids,'uniacid'=>$_SESSION['uniacid'],'zhun_time >'=>$daytime),'id');
	$shangmen['youxiao']=pdo_count('jy_yxw_member',array('worker'.$juese_id.'id'=>$workerids,'storeid'=>$_SESSION['storeid'],'uniacid'=>$_SESSION['uniacid'],'status'=>$status4,'zhun_time >'=>100),'id');
	$shangmen['youxiaoday']=pdo_count('jy_yxw_member',array('worker'.$juese_id.'id'=>$workerids,'storeid'=>$_SESSION['storeid'],'uniacid'=>$_SESSION['uniacid'],'status'=>$status4,'zhun_time >'=>$daytime),'id');
	$member['day'] = pdo_count('jy_yxw_member',array('worker'.$juese_id.'id'=>$workerids,'uniacid'=>$_SESSION['uniacid'],'to5time >'=>$daytime));
	$member['all'] = pdo_count('jy_yxw_member',array('worker'.$juese_id.'id'=>$workerids,'uniacid'=>$_SESSION['uniacid']));
	$isbao['day'] = pdo_count('jy_yxw_member',array('worker'.$juese_id.'id'=>$workerids,'uniacid'=>$_SESSION['uniacid'],'status <'=>100,'buy_time >'=>$daytime));
	$isbao['all'] = pdo_count('jy_yxw_member',array('worker'.$juese_id.'id'=>$workerids,'uniacid'=>$_SESSION['uniacid'],'status <'=>100,'buy_time >='=>9));
	$htmls=array(
		array('type'=>'data','num'=>12,'one_num'=>3,'title'=>'今日/总数据','datas'=>array(
			array('title'=>'客户数','num'=>2,'data'=>array($member['day'],$member['all'])),
			array('title'=>'意向数','num'=>2,'data'=>array($shangmen['youxiaoday'],$shangmen['youxiao'])),
			array('title'=>'有效意向数','num'=>2,'data'=>array($shangmen['day'],$shangmen['all'])),
			array('title'=>'成交数','num'=>2,'data'=>array($isbao['day'],$isbao['all'])),
		)),
	);
	$return['htmls']=$htmls;
	exi($return);
}